<%@ page import="com.zhiyou100.javaweb.myservlet.homework.day004.studentmanagementsystem.Student" %>
<%-- 引入 Studnet 类 --%>
<%--
  Created by IntelliJ IDEA.
  User: yang
  Date: 2020/5/28
  Time: 11:33 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>jsp动作标签</title>
</head>
<body>
<h1>demo06.jsp</h1>

<%-- jsp 动作标签 --%>

<%--<jsp:forward page="/day006/error.jsp" />--%>
<%--
    jsp:forward 等价于
    request.getRequestDispatcher("/day006/error.jsp").forward(request.response);
--%>
<%--<jsp:include page="/day006/error.jsp" />--%>
<%--
    jsp:include 等价于
    request.getRequestDispatcher("/day006/error.jsp").include(request.response);
--%>



<%-- 通过 java 片段实现：创建一个student对象给属性赋值 --%>
<%
    Student student1 = new Student();
    student1.setStudentId(12);
    student1.setStudentName("韩妹妹");
%>

<%-- 通过 jsp 动作标签实现：创建一个Studnet对象给属性赋值 --%>
<jsp:useBean id="student2" class="com.zhiyou100.javaweb.myservlet.homework.day004.studentmanagementsystem.Student" />
<%--
调用 class 指定的类的无参数的的构造方法创建一个对象，名字叫做 student2
等价于 Student student2 = new Student();
 --%>
<jsp:setProperty name="student2" property="studentId" value="13" />
<%--
给name指定的对象的property属性赋值为value
等价于 student2.setStudentId(13);
--%>
<jsp:setProperty name="student2" property="studentName" value="韩更"/>
<%--
给name指定的对象的property属性赋值为value
等价于 student2.setStudentName("韩更");
--%>
name=<jsp:getProperty name="student2" property="studentName"/>
<%--
页面输出name指定的对象的property属性的值
等价于 <%=s2.getStudnetName()%>
--%>
<br>
面试题目：jsp的include动作标签和include指令标签的区别


</body>
</html>
